package com.hengyi.pda.activity;

import android.os.Bundle;
import android.widget.TextView;

import com.common.broadcastRecever.ScanDataBroadcastReceiver;
import com.common.mvp.BaseMvpActivity;
import com.common.mvp.BasePresenter;
import com.common.rxbus.RxBus;
import com.common.rxbus.postevent.RxKeyEvent;
import com.hengyi.pda.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ScanDeleteActivity extends BaseMvpActivity {
    @BindView(R.id.tv_num)
    TextView tvNum;
    private ScanDataBroadcastReceiver scanDataBroadcastReceiver;

    @Override
    protected BasePresenter createPresenterInstance() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_delete;
    }

    @Override
    protected void onViewCreated() {

    }

    @Override
    protected void doLogicFunc() {
        openScanEnable();
        scanOutputDisable();
        scanDataBroadcastReceiver = new ScanDataBroadcastReceiver(new ScanDataBroadcastReceiver.PdaCallBack() {
            @Override
            public void setinfo(String s) {
                if (isAccept) {
                    RxBus.getDefault().post(new RxKeyEvent(RxKeyEvent.SCAN_DELETE, s));
                    tvNum.setText(s);
//                    showToastMsg("删除成功！");
                    onBackPressed();
                }

            }
        });
        setScanReceiver(scanDataBroadcastReceiver);
    }

    @Override
    protected void setNavigation() {
        setNavigationBack("扫描删除");
    }

    @Override
    public void bindKnife() {
        ButterKnife.bind(this);

    }
}
